package com.bwie.controller;

import com.bwie.common.domain.request.ShopListRequest;
import com.bwie.common.domain.response.ShopListResponse;
import com.bwie.common.result.Result;
import com.bwie.domain.EsShop;
import com.bwie.service.EsShopService;
import org.dromara.easyes.core.biz.EsPageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * es店铺控制层
 *
 * @author <a href="mailto:3364114353@qq.com">liuwenliang</a>
 * @version 1.0
 * @description: es店铺控制层
 * @date 2025/9/9 11:58
 */
@RestController
@RequestMapping("/esShop")
@CrossOrigin
public class EsShopController {


    @Autowired
    private EsShopService esShopService;

    /**
     * 创建索引
     */
    @PutMapping("/createIndex")
    public void createIndex () {
        esShopService.createIndex();
    }


    /**
     * 店铺列表，分页
     * @param shopListRequest
     * @return
     */
    @PostMapping("/esPage")
    public Result<EsPageInfo<EsShop>> esPage (@RequestBody ShopListRequest shopListRequest) {
        EsPageInfo<EsShop> esPageInfo = esShopService.esPage(shopListRequest);
        return Result.success(esPageInfo);
    }

}
